from OWAOperator.Operator import Operator
class POWA(Operator):
    def getResult(self):
        """
        概率OWA算子
        data顺序不变
        :return:
        """
        # 对数据进行简化
        data = self.data_list
        weight = self.weight_list
        P = self.P_list
        rate = self.rate_list
        # 获取初始值(ai[0] * w[0] * Wrate[0] + ai[0] * P[0] * Prate[1])
        res = data[0] * weight[0] * rate[0] + data[0] * P[0] * rate[1]
        for i in range(len(data)):
            res += data[i] * weight[i] * rate[0] + data[i] * P[i] * rate[1]

        return res


if __name__ == '__main__':
    data_list = [343.30,412.71,389.42,372.68,363.49,363.28]
    weight_list = [0.10,0.10,0.15,0.15,0.20,0.30]
    P_list = [0.15, 0.15, 0.15, 0.15, 0.20, 0.20]
    rate_list = [0.6, 0.4]
    pa = POWA(data_list)
    print(pa.getResult())